package com.gonsin.gview.common.po;

import com.gonsin.gview.common.bean.UserBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.BeanUtils;

import java.util.Date;
import java.util.List;

/**
 * 用户模板
 */
@Data
@ApiModel("用户模板")
public class UserBo extends UserBean {

    @ApiModelProperty("权限组名称")
    private String groupName;

    @ApiModelProperty("该用户拥有的权限")
    private List<String> permissions;       // 该用户拥有的权限

    @ApiModelProperty("该用户所属的edificeKey")
    private List<String> edificeKeys;

    @ApiModelProperty("当前登录访问的edifice")
    private String edificeKey;

    @ApiModelProperty("是否有审核权")
    private boolean audit;

    @ApiModelProperty("是否有免审核权")
    private boolean freeAudit;

    @ApiModelProperty("该用户可访问的目录，默认为根目录")
    private String rootUrl;

    @ApiModelProperty("创建时间")
    private Date createTime;

    @ApiModelProperty("修改时间")
    private Date updateTime;

    @ApiModelProperty("是否删除 0否 1是")
    private Integer delete;
    @ApiModelProperty("登录凭证")
    private String token;

    public UserBo(){

    }

    public UserBo(UserBean u){
        BeanUtils.copyProperties(u, this, "password");
    }

    public List<String> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<String> permissions) {
        this.permissions = permissions;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getToken() {
        return token;
    }
}
